﻿using KouDai.WinPad.Helper;
using KouDai.WinPad.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Data;

namespace KouDai.WinPad.Controls
{
    public class ShellZoomOutDataTemplateSelector : DataTemplateSelector
    {
        public DataTemplate ZoomOutTemplate { get; set; }
        public DataTemplate ZoomOutCategoryTemplate { get; set; }

        protected override Windows.UI.Xaml.DataTemplate SelectTemplateCore(object item, Windows.UI.Xaml.DependencyObject container)
        {
            if (item is ICollectionViewGroup)
            {
                GroupCollection<HoneyEntity> group = (GroupCollection<HoneyEntity>)((ICollectionViewGroup)item).Group;
                ZoomOutModel zoomOutModel = (ZoomOutModel)group.Key;
                if (!zoomOutModel.GroupName.Contains("分类"))
                {
                    return ZoomOutTemplate;
                }
                else
                {
                    return ZoomOutCategoryTemplate;
                }
            }
            return base.SelectTemplateCore(item, container);
        }
    }
}
